package cn.stylefeng.guns.modular.launchpad.controller;

import cn.stylefeng.guns.modular.base.util.Result;
import cn.stylefeng.guns.modular.launchpad.entity.Distribution;
import cn.stylefeng.guns.modular.launchpad.service.DistributionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/distribution")
public class DistributionController {
    private String PREFIX = "/modular/launchpad/distribution/";

    @Autowired
    private DistributionService distributionService;


    /**
     * 跳转到分发记录首页
     */
    @RequestMapping("")
    public String index() {
        return PREFIX + "distribution.html";
    }

    /**
     * 跳转到添加分发记录
     */
    @RequestMapping("/distribution_add")
    public String distributionAdd() {
        return PREFIX + "distribution_add.html";
    }


    // 查询分发记录列表
    @ResponseBody
    @GetMapping("/list")
    public Result getList(Distribution distribution) {
        return Result.success(distributionService.getList(distribution));
    }


}
